package com.swsc.solarverse.model.res;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.swsc.solarverse.common.enums.DefectProcessStateEnums;
import com.swsc.solarverse.common.enums.DefectStateEnums;
import com.swsc.solarverse.common.util.LocalDateTimeUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * @Description
 * @Author licm
 * Copyright (c) 永辉金融
 * Create time 2021-5-2 12:28
 * <p>
 * Date         Author      Version     Description
 * ---------------------------------------------------------
 * 2021-5-2      licm        1.0         新建
 **/
@Data
//@ApiModel
@NoArgsConstructor
@AllArgsConstructor
public class StationDefectResVO {
    private Integer id;

//    @ApiModelProperty(value = "租户编号")
    private Integer tenantNo;

//    @ApiModelProperty(value = "电站编号")
    private Integer organNo;
//    @ApiModelProperty(value = "电站名称")
    private String organName;

//    @ApiModelProperty(value = "巡检时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDateTime patrolTime;

//    @ApiModelProperty(value = "消缺时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDateTime dealTime;

//    @ApiModelProperty(value = "故障类型名称")
    private String faultName;

//    @ApiModelProperty(value = "设备编码")
    private String deviceCode;

//    @ApiModelProperty(value = "损耗")
    private Float loss;

//    @ApiModelProperty(value = "经度")
    private Double longitude;

//    @ApiModelProperty(value = "纬度")
    private Double latitude;

//    @ApiModelProperty(value = "故障等级")
    private String faultLevel;

//    @ApiModelProperty(value = "区域")
    private String zone;

//    @ApiModelProperty(value = "持续时间")
    private String durationTime;

//    @ApiModelProperty(value = "备注")
    private String remark;
    private String dealRemark;
    private String auditRemark;
    private String dealer;
    private String auditor;

//    @ApiModelProperty(value = "标记颜色")
    private String markColor;
//    @ApiModelProperty(value = "故障状态")
    private String state;

//    @ApiModelProperty(value = "状态名称")
    private String stateName;

    private String processState;
    private String processStateName;
//    @ApiModelProperty(value = "故障位置")
    private String faultPosition;

    public String getStateName() {
        return DefectStateEnums.getName(state);
    }

    public String getProcessStateName() {
        return DefectProcessStateEnums.getName(processState);
    }

    public String getDurationTime() {
        return LocalDateTimeUtils.durationDays(patrolTime, null != dealTime ? dealTime : LocalDateTime.now());
    }
}
